/*
 * TraceabilityTree.java
 *
 * $Id: TraceabilityTree.java,v 1.1 2008-03-18 12:58:46 mario Exp $
 */
package org.ceteca.explica.core.traceability.tree;

/**
 * ValueObject with the data of a Traceability Tree.
 * <br/>
 * Responsibilities:
 * <ul>
 *  <li>Store the traceability tree data.</li>
 * </ul>
 * <br/>
 * @author Mario García García <mario@imagos.es>
 * Copyright (c) 2007 Fundación Centro Tecnolóxico da Carne
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * <br/>
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * <br/>
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
public class TraceabilityTree {
	/** Root product of the traceability tree */
	private ProductInfo product;
	/** Path to the DTD file to validate the traceability tree file */
	private String xmlns;
	
	/**
	 * Default TraceabilityTree constructor.
	 * @param xmlns String, path to the validation DTD file.
	 */
	public TraceabilityTree(String xmlns) {
		this.setXmlns(xmlns);
	}
	
	/**
	 * Gets the root product of the traceability tree.
	 * @return ProductInfo, root product's data.
	 */
	public ProductInfo getProduct() {
		return product;
	}
	/**
	 * Sets up the root product of the traceability tree.
	 * @param product ProductInfo, product data.
	 */
	public void setProduct(ProductInfo product) {
		this.product = product;
	}
	
	/**
	 * Gets the validation DTD file path.
	 * @return String, validation DTD file path.
	 */
	public String getXmlns() {
		return xmlns;
	}
	/**
	 * Sets up the validation DTD path.
	 * @param xmlns String, a file path.
	 */
	public void setXmlns(String xmlns) {
		this.xmlns = xmlns;
	}
	
	/**
	 * Converts the traceability tree info to a formatted String.
	 * @return String, formatted String with the traceability tree's root
	 * product data.
	 */
	public String toString() {
		if (product == null)
			return "NO PRODUCT SPECIFIED";
		else
			return product.toString();
	}
}
